Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sumor/config

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumor/config

Config Loader support .yml, .yaml, .json and .config.js files. It can load all files in a directory.

  • 1.3.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
70K
decreased by-0.14%
Maintainers
0
Weekly downloads
 
Created
Source

config

A Sumor Cloud Tool.
More Documentation

Config Loader support .yml, .yaml, .json and .config.js files. It can load all files in a directory.

CI Test Coverage Audit

Installation

npm i @sumor/config --save

Prerequisites

Node.JS version

Require Node.JS version 18.x or above

require Node.JS ES module

As this package is written in ES module, please change the following code in your package.json file:

{
  "type": "module"
}

Usage

entry methods

load
import { load } from '@sumor/config'

const config = await load(process.cwd(), 'config')
// will load config.yml, config.yaml, config.json, config.config.js
  • root: string - root directory
  • name: string - file name
meta

load all files in the directory

  • root: string - root directory
  • suffix: string - object suffix which will be load into config (js will only load path)
import { meta } from '@sumor/config'

const config = await meta(process.cwd(), ['js', 'sql'])

/*
Demo directory structure
- root
  - car.json
  - car.sql
  - ship.js
  - plane.yml
  - truck.config.js
*/

// it will load all config files as below
/*
{
  car: {
    name: 'car',
    sql: "..."
  },
  ship: {
    name: 'ship'
    js: '<root>/ship.js'
  },
  plane: {
    name: 'plane'
  },
  truck: {
    name: 'truck'
  }
*/

Keywords

FAQs

Package last updated on 02 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc